using System;
using System.Collections.Generic;
using System.Text;
using Ghasam.Business.Domain.Entity;
using Ghasam.Business.DAO;
using System.Collections;
using Spring.Transaction.Interceptor;

namespace Ghasam.Business.Services.Impl
{
    public class CustomerService : ICustomerService
    {
        private ICustomerDao customerDao;

        public ICustomerDao CustomerDao
        {
            get { return customerDao; }
            set { customerDao = value; }
        }

        #region ICustomerService Members

        public int CountCustomers(Customer exampleCustomer)
        {
            return customerDao.CountCustomersByExample(exampleCustomer);
        }

        public IList<Customer> GetCustomers(Customer exampleCustomer, int pageSize, int PageNumber)
        {
            return customerDao.GetCustomerByExample(exampleCustomer, pageSize, PageNumber);
        }

        public Customer FindCustomer(int id)
        {
            return customerDao.FindById(id);
        }

        [Transaction(ReadOnly=false)]
        public void Persist(Customer customer)
        {
            customerDao.SaveOrUpdate(customer);
        }

        #endregion
    }
}
